//获取应用实例
const app = getApp();

Page({
  data: {
    rentalty:[],
    lo:'https://xiaochengxu.printeasy.top',
    years:[],
    'rentaltyList': [
      {
        'name': '（全新）墨仓式7色照片8色照片打印机',
        'fangshi': '包月',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
      {
        'name': '（全新）喷墨式7色照片8色照片打印机',
        'fangshi': '包月',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
      {
        'name': '（全新）激光式7色照片8色照片打印机',
        'fangshi': '包月',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
    ],
    'yearsList': [
      {
        'name': '（全新）墨仓式7色照片8色照片打印机',
        'fangshi': '两年赠机',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
      {
        'name': '（全新）喷墨式7色照片8色照片打印机',
        'fangshi': '两年赠机',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
      {
        'name': '（全新）激光式7色照片8色照片打印机',
        'fangshi': '两年赠机',
        'dizi': 'http://china.pr.img.coovee.net/picture/2014-6/18_17_27_56_015.jpg',
        'price': 88.2,
      },
    ],
    currentTap:0,
    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '设备租凭', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  onLoad() {
    let url = app.globalData.URL+'goods/commodity/wx/rent/list/1';
        let data = {};
        let that = this;
        app.wxRequest('GET', url, data, (res) => {
          let rentalty = res.rows
          that.setData({
            rentalty:rentalty
          })
          console.log(rentalty)
        }, (err) => {
          console.log(err.errMsg)
        })
  },
  onShow:function(){
    let that = this;
    let url = app.globalData.URL+'goods/commodity/wx/rent/list/2';
        let data = {};
        app.wxRequest('GET', url, data, (res) => {
          let years = res.rows
          that.setData({
            years:years
            
          })
          console.log(years)
        }, (err) => {
          console.log(err.errMsg)
        })
  },
  order_status: function (e) {
    var current = e.currentTarget.dataset.current
    this.setData({
      currentTap: current
    })
  },
  gotoproduct_details:function(e){
    var id = e.currentTarget.dataset.id;
    console.log(e)
    wx.navigateTo({
      url: '/pages/shoppingcarts/product_details/product_details?id='+id,
      complete: (res) => {},
      fail: (res) => {},
      success: (result) => {

      },
    })
  },

})
